<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登录主页</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="<%=path%>/js/jquery.js"></script>
	<script type="text/javascript" src="<%=path%>/js/home/home.js"></script>
	
	<script language="JavaScript">
		function check(form){
			var id = loginform.elements[0].value;
			var password = loginform.elements[1].value;	
			var pattern = /^\d{1,10}$/
			if(id==""){
				alert("账号不能为空！");
				return false;		
			}else if(!pattern.test(id)) {
				alert("请输入有效账号！账号必须是数字");
				return false;
	
			}else if (password==""){
				alert("密码不能为空");
				return false;
			
			}
			//return false;
		}
	</script>
	<link href="layout.css" rel="stylesheet" type="text/css" />

	
  </head>
  
  <body>
  
    <!--<div style="width: 100%;height:25%;border:solid" id="title">  -->
    <div id="container">
	    <div id="title">
	    	<span style="float:right"></span>
	    </div>
	    <div id="menu1">
	    	<s:set name="a" value="%{b}"/>
	    	<s:if test="#a==true">
	    	<a style="font-size:17px;">欢迎：<s:property value="user.userName"/></a>
	    	</s:if>
	    
	    </div>
	    <div id="mainContent">
		    <div  id="menu">
		    	<form  id="loginform" action="login" method="post" onSubmit="return check(this)">
		    		<h1>登录</h1>
		    		 
		    		<table>
		    			<tr>
		    				<td>
		    				</td>
		    				<td align="center">
		    					<a style="color: red;"><s:property value="errors.user[0]"/></a>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td>用户：</td>
		    				<td><input type="text" name="user.userName" maxlength="10"/ ></td>
		    				
		    			</tr>
		    			<tr>
		    				<td>密码：</td>
		    				<td><input type="password" name="user.password" maxlength="10"/></td>
		    			</tr>
		    			<tr>
		    				<td>身份：</td>
		    				<td>
		    					<select name="user.status">
		    						<option value="1">学生</option>
		    						<option value="2">老师</option>
		    						<option value="3">管理员</option>
		    					</select>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td></td>
		    				<td><input type="submit" value="登录"/></td>
		    			</tr>
		    		</table>
		    	</form>
		    	<s:hidden id="type" name="%{user.status}"></s:hidden>
		    	<s:hidden id="return" name="%{b}"></s:hidden>
		    </div>
		    <div id="content">
		    	<center>
			    	<h2>学生管理系统</h2>
			    	<a style="color: red"><s:property value="errors.registfailstu[0]"/> </a>
			    	<a style="color: red"><s:property value="errors.registfailtea[0]"/> </a>
			    	<br/>
			    	<a href="javascript:void(0)" id="registerStu">学生注册</a>
			    	<a href="javascript:void(0)" id="registerTea">老师注册</a>
			    	
		    	</center>
		    </div>
	    </div>
	    <div id="footer">
	    	<center>Copyright (C) 2011 zhangwenyue.All Rights Reserved</center>
	    </div>
  </div>  
  </body>
</html>
